// src/dto/question.dto.ts
import { IsArray, IsNumber, IsString, ValidateNested } from 'class-validator';
import { Type } from 'class-transformer';

export class QuestionItemDto {
  @IsNumber()
  id: number;

  @IsString()
  type: string;

  @IsString()
  difficulty: string;

  @IsString()
  question: string;

  @IsArray()
  options: string[];

  @IsArray()
  correctAnswer: number[];

  @IsString()
  explanation: string;
}

export class ListItemDto {
  @IsNumber()
  id: number;

  @IsString()
  title: string;

  @IsString()
  type: string;

  @IsNumber()
  difficulty: number;

  @IsString()
  status: string;

  @IsArray()
  tags: string[];

  @IsNumber()
  timeLimit: number;

  @ValidateNested({ each: true })
  @Type(() => QuestionItemDto)
  questions: QuestionItemDto[];
}
